/**
 * Factory class that creates an instance of a geocoder object.
 * By submitting a provider name, the user can define the provider of the geocoding service.
 * 
 * @author Kim Pommert
 * @version %I%, %G%
 */

qx.Class.define("qooxdoosample.cocktail.maps.GeoCoderFactory",
{
	// The class only has a static method, so it will be declared as static
	type: "static",
	
	statics:
	{

		
		/**
		 * Creates an instance of a Geocoder object.
		 * When the provider parameter is set, the user can decide 
		 * which implementation of the geocoder interface will be returned.
		 * 
		 * @param provider	{qooxdoosample.cocktail.maps.provider.GeocoderProvider?} defines the provider of the geocoding service
		 * @return 			{qooxdoosample.cocktail.maps.IGeoCoder} The specified GeoCoder object
		 */
		createGeoCoder: function(provider)
		{
			if(provider != null) // user defined a specific provider
			{
				if(provider == qooxdoosample.cocktail.maps.provider.GeocoderProvider.GOOGLE)
					return new qooxdoosample.google.maps.GGeoCoder();
				else if(provider == qooxdoosample.cocktail.maps.provider.GeocoderProvider.BING)
					return new qooxdoosample.microsoft.bing.maps.BGeoCoder();
			} 
			else // return default provider
			{
				return new qooxdoosample.google.maps.GGeoCoder();
			}
		}
	}
	
});